jconed.toolbar.register_handler ( 'DL box', function ( editor )
{
	if ( typeof ( download_manager ) != 'undefined' )
	var f = new liwe.form.instance ( 'jconed-dl-box', 'no-action' );

        // create filter form
        f.hidden ( "module", download_manager._module );
        f.hidden ( "id_obj", "" );
        f.label ( { value: "Nome file" } );
        f.text   ( { name: "name", maxlength: 200 } );
        f.label ( { value: "Descrizione" } );
        f.text   ( { name: "descr", maxlength: 200 } );
        f.label ( { value: "Estensione" } );
        f.select ( { name: "fext", options: download_manager._ext_list, force_select: false, style: "width:150px;" } );
        f.label ( { value: "Tags" } );
        f.tags   ( { name: "filters_tags", module: download_manager._module } );
        f.button ( { value: "Preview", 'class': 'green', onclick: "jconed.__dl_box_preview" } );
        f.button ( { value: "Reset", 'class': 'yellow', onclick: this.form.reset() } );

	f.workspace ( { name: 'jconed-dl-box-preview' } );
	/*
	f.text ( { label: '', name: 'image', size: 30, nonl: true } );
	if ( typeof ( download_manager ) != 'undefined' )
		f.button ( { value: '...', onclick: 'jconed.__image_dlm(); return false' } );
	f.submit ( 'Insert' );
	f.events [ 'submit' ] = function ()
	{
		var image = f.get_value ( 'image' );
		jconed.execute ( 'insertImage', image );
		return false;
	};
	jconed.toolbar.set_context ( f.get () );
	*/
} );

jconed.__dl_box_preview = function ()
{
	var f = liwe.form.get ( 'jconed-dl-box' );
	var params = f.get_values ();
	var module = params.get ( 'module', 'download_manager' );
	
	download_manager.dl_box ( params, 'jconed-dl-box-preview', module, 'list' );
};
